#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
int w, m, n;
int ans;
int main(void)
{
    cin >> w >> m >> n;
    int h1, h2, l1, l2;
    h1 = m / w + 1;
    h2 = n / w + 1;

    if (h1 % 2 != 0)
        l1 = m % w;
    else
        l1 = (w - (m % w)) % w + 1;

    if (h2 % 2 != 0)
        l2 = n % w;
    else
        l2 = (w - (n % w)) % w + 1;

    ans = abs(h2 - h1) + abs(l2 - l1);
    cout << ans << endl;

    return 0;
}